﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  
</head>

<body class="ms-theme-blue">

  <%@ include file="/WEB-INF/include/header.jsp"%>
  <%@ include file="/WEB-INF/include/submenu.jsp"%>

  <div class="container-fluid umu-container has-umu-sidemenu">
    <div class="umu-breadcrumb">
      <div class="breadcrumb">${dynamicReport.name }</div>
      
    </div>
    

    <div class="panel-default beast-panel beast-panel-layout">

      <div class="panel-body">

        <div class="col-xs-12 beast-panel-layout-right">
             <div class="form-group  ms-form-group">
	          <label class="control-label col-xs-2">切换报表：</label>
				<div class="col-xs-2">	              
					<select class="select2 form-control" name="reportId" data-validate="required" id="selReportId" tabindex="1" onChange="doChange(this.value,'${ctx.host}');">
		                <option></option>
		                <c:forEach items="${reports}" var="dynamicReport">
		                  <option value="${dynamicReport.id}" <c:if test="${reportId eq dynamicReport.id }">selected</c:if>>${dynamicReport.name}</option>
		                </c:forEach>	
		            </select>
	            </div>
	            <a href="${ctx.host}/dynamic-report/report-upload" class="btn btn-shadow-success btn-shadow umu-btn" data-target="#upload" data-toggle="modal"> 
					  <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;上传新报表
				</a>
	        </div>          

    		  <div class="ms-content-layout">
		      <div class="ms-operation-bar no-margin no-bottom-border clearfix">
		        <div class="ms-operation-group pull-right">
		          <a href="${ctx.host}/dynamic-report-export?${queryString}" class="btn btn-shadow-success btn-shadow umu-btn" <c:if test="${recordCount==null || recordCount<1 }">disabled</c:if>>
		            <i class="glyphicon glyphicon-send"></i>&nbsp;&nbsp;导出全部
		          </a>
		        </div>
		      </div>		    
		    
		    
		      <table class="table table-hover umu-table tab-pane table-striped">
		        <thead>
		          <tr>
		          <c:forEach items="${columns}" var="column" varStatus="status">
		          	<th>${column}</th>
		          </c:forEach>
		          </tr>
		        </thead>
		        <tbody>
		        <c:forEach items="${dynamicReports}" var="dynamicReportData" >
		        	<tr>
			          <c:forEach items="${dynamicReportData.colValues}" var="colValue" varStatus="status">
			          	<c:if test="${columnCount>=status.count }">
			          	<td>${colValue}</td>
			          	</c:if>
			          </c:forEach>
			    	</tr>
		        </c:forEach>
		        </tbody>
		        <tfoot>
		          <tr>
		            <td colspan="11" class="no-vertical-padding">
		              <div class="pull-left">
		                <jsp:include page="/WEB-INF/include/page.jsp">
		                  <jsp:param name="url" value="${ctx.host}/dynamic-report" />
		                  <jsp:param name="queryString" value="${queryString}" />
		                </jsp:include>
		              </div>
		            </td>
		          </tr>
		        </tfoot>
		      </table>
		    </div>           
        </div>

      </div>

    </div>

  </div>

  <%@ include file="/WEB-INF/include/footer.jsp"%>
  <%@ include file="/WEB-INF/include/script.jsp"%>
<d:resource root="${ctx.resource}/build" type="script" src="js/page/report/dynamic-report.js" />
<script type="text/javascript">
        require([ 'page/report/dynamic-report' ], function(page) {
            page.init();
        })
    </script>

</body>
</html>